enum ResourceType {
    test,
    local,
    h5,
    develop,
    master
}

const enum GameDebug {
    Actor = 0,
    Action = 0,
    Gun = 0,
    Platform = 0,
    Shoot = 0,
    UI = 0,
    Scene = 0,
    Roll = 0,
    Effect = 0,
    Guide = 0,
    Game = 0,
    Load = 0,
}

type GameVersion = {
    game: string;
    res: string;
    data: string;
}

const testlevel = 'level_test';

class GameSettings {
    static versions: GameVersion;
    
    static forceCleanCache = false;
    public static resType: ResourceType = ResourceType.test;

    static async loadVersion() {
        // let version = await RES.getResAsync('version.json');
        // GameSettings.versions = JSON.parse(version);
        GameSettings.versions = JSON.parse('{"game":"1.0.6","res":"0.0.45","data":"0.0.104"}');
        Logger.info("GameSettings game=" + GameSettings.versions.game + ' res=' + GameSettings.versions.res + ' data=' + GameSettings.versions.data);
    }

    static get defaultUrl(): string {
        if (GameSettings.resType == ResourceType.test) {
            return "http://10.1.1.62:8080/";
        } else if (GameSettings.resType == ResourceType.local) {
            return "http://10.1.1.62:8080/";
        } else if (GameSettings.resType == ResourceType.h5) {
            return "http://10.1.2.13:8080/";
        } else if (GameSettings.resType == ResourceType.develop) {
            return "https://sniper.dev.hortorgames.com/";
        }
        return "https://sniper.hortorgames.com/";
    }
    static getResConfig() {
        return `${GlobalManager.instance.resUrl}default.res.json`;
    }

    static getResRoot(): string {
        if (GameSettings.resType == ResourceType.develop)
            return "https://sniper-wscdn.dev.hortorgames.com/";
        else if (GameSettings.resType == ResourceType.master)
            return "https://sniper-wscdn.hortorgames.com/";
        return "/";
    }
}